package com.hyt.it.ogt.kq.main.controller.bm;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.hyt.common.apiInfor.ApiResponse;
import com.hyt.it.ogt.kq.common.bm.utils.Constant;
import com.hyt.it.ogt.kq.main.controller.base.BaseController;
import com.hyt.it.ogt.kq.service.bm.service.IWeChatService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSort;
import io.swagger.annotations.ApiSort;
import lombok.extern.slf4j.Slf4j;

/**
 * @program: it-ogt-bm
 * @description: 微信操作
 * @author: Yang HuanKun
 * @create: 2022-01-20 10:05
 **/
@Slf4j
@RestController
@Api(tags = "23.微信操作接口", value = "微信操作接口")
@ApiSort(value = 23)
@RequestMapping("/bm/weChat")
public class WeChatController extends BaseController {

    @Resource
    private IWeChatService weChatService;

    /**
     * 获取指定场景下的微信推送模板
     * <p>
     *
     * @return
     */
    @ApiOperation(
            value = "23.1.1  获取指定场景下的微信推送模板",
            notes = "20000：成功；31231101：获取指定场景下的微信推送模板异常"
    )
    @ApiOperationSort(value = 1)
    @RequestMapping(value = "/listNotifyTemplates", method = RequestMethod.GET)
    public ApiResponse<List<String>> listNotifyTemplates() {
        try {
            return ApiResponse.<List<String>>builder()
                    .code(Constant.RESPONSE_CODE_SUCCESS)
                    .data(weChatService.listNotifyTemplates())
                    .build();
        } catch (Exception e) {
            log.error("# 对获取指定场景下的微信推送模板异常", e);
            return ApiResponse.<List<String>>builder()
                    .code(Constant.RESPONSE_CODE_31231101)
                    .build();
        }
    }
}
